package backgroundsvcs

import (
	"go-caipu/pkg/api"
	"go-caipu/pkg/plugins/manager/store"
	"go-caipu/pkg/registry"
	"go-caipu/pkg/services/grpcserver"
	"go-caipu/pkg/services/monitor/onlineuser/impl"

	jobsImpl "go-caipu/pkg/services/schedule/impl"
)

func ProvideBackgroundServiceRegistry(httpServer *api.HTTPServer,
	grpcServerProvider grpcserver.Provider, _ *grpcserver.AdminService,
	jobs *jobsImpl.Service, pluginStore *store.Service, onlineUser *impl.Service) *BackgroundServiceRegistry {
	return NewBackgroundServiceRegistry(httpServer, grpcServerProvider, jobs, pluginStore, onlineUser)
}

type BackgroundServiceRegistry struct {
	Services []registry.BackgroundService
}

func NewBackgroundServiceRegistry(services ...registry.BackgroundService) *BackgroundServiceRegistry {
	return &BackgroundServiceRegistry{services}
}
func (r *BackgroundServiceRegistry) GetServices() []registry.BackgroundService {
	return r.Services
}
